<template>
    <div class="mapInfo">
        <div id="container"></div>
    </div>
</template>

<script>
    import {nowest, sensor, water, Anion, AnionWeek} from '../../axios/map/index'
    import {airSeven} from '../../axios/ecology/index'
    import moment from 'moment'

    export default {
        name: "mapInfo",
        props: {
            markerArr: Array
        },
        data() {
            return {
                map: null,
                markerInfoArr: [],//所有点标记
                infoWindow: null, // 信息窗体
                AnionSevenArr: null,//负离子7天数据
            }
        },
        mounted() {
            this.init_map()
        },
        methods: {
            /**
             * 初始化地图
             */
            init_map() {
                console.log('初始化地图')
                const imageLayer = new AMap.ImageLayer({
                    bounds: new AMap.Bounds(
                        [115.866331, 39.112493],
                        [115.959888, 39.067592]
                    ),
                    url: require('@/assets/cad-01.png'), // 图片 Url
                    zooms: [10, 18], // 设置可见级别，[最小级别，最大级别]
                })
                const map = new AMap.Map("container", {
                    center: [115.9155, 39.08746],
                    zoom: 15,
                    mapStyle: "amap://styles/8e3218254f4b97da10d4040c895fd178",
                    zooms: [15, 18],
                    layers: [new AMap.createDefaultLayer(), imageLayer],
                });
                this.$emit('set-map', map);
            },
        }
    }
</script>

<style scoped lang="scss">
    .mapInfo {
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        background: #eee;

        #container {
            width: 100%;
            height: 100%;
        }
    }
</style>